import axios from 'axios'
import { React, useState, useEffect } from "react";
import InterIP from "../../IP/IP";
import { Rate, Empty } from 'antd';
import 'antd/dist/antd.css';

export default function IntegralId_evaluate() {
 const [evaluate, setEvaluate] = useState([]);
 useEffect(() => {
  let IP = InterIP().props.children;
  let integralId = localStorage.getItem('integralId')
  axios.post('http://' + IP + ':3000/index/selIntegral/evaluate', {
   integral_id: integralId,
  }).then((res) => {
   setEvaluate((evaluate) => evaluate = res.data);
  })
 }, []);
 return (
  <div className="evaluate">
   {(evaluate.length) ? evaluate.map((data, key)=>{return (<div className="product_evaluate" key={key}><div className="product_evaluate_user"><div><img src={data.user_header} alt="" /></div><h4>{data.user_name}</h4></div><div className="product_evaluate_content"><div><div><Rate disabled defaultValue={data.user_score} /></div><div>{data.evaluate_time}</div></div><div>{data.evaluate_text}</div></div></div>)}) : <Empty description='暂无评价'/>}
  </div>
 )
}
